<template>
  <div class="alist">
    <img src="" alt="" />
    <div class="nav">
      <div class="sousuo">
        <el-input v-model="input" placeholder="请输入医院名称" />
      </div>
      <div class="search">
        <span class="iconfont icon-sousuo">&emsp;搜索</span>
      </div>
      <div class="reset">
        <span class="iconfont icon-zhongzhi">&emsp;重置</span>
      </div>
    </div>

    <div class="table">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="host" label="预约人" />
        <el-table-column prop="petName" label="宠物名称" />
        <el-table-column prop="petType" label="品种" />
        <el-table-column prop="vaccine" label="疫苗类型" />
        <el-table-column prop="name" label="接种医生" />
        <el-table-column prop="yuyuetime" label="接种时间" />
        <el-table-column label="操作">
          <img src="../../assets/img/4.png" alt="" /><span> </span>
        </el-table-column>
      </el-table>
      <el-pagination
        v-model:currentPage="currentPage1"
        :page-sizes="[9]"
        :page-size="9"
        layout="total, sizes, prev, pager, next, jumper"
        :total="45"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script lang="ts">
import { mockService } from "../../api/mock";
import { defineComponent, ref, onMounted } from "vue";
// import { Star } from "@element-plus/icons-vue";
export default defineComponent({
  setup() {
    const handleSizeChange = (val: any) => {
      console.log(`${val} items per page`);
    };

    const onClick = () => {
      alert(1);
    };

    // let page: any = ref(1)
    const handleCurrentChange = async (val: any) => {
      const res = await mockService.getServerList(val, 9);
      tableData.value = res.result;
      // console.log(tableData);
    };
    let tableData = ref([]);

    onMounted(async () => {
      // console.log(page);
      const res = await mockService.getServerList(1, 9);
      tableData.value = res.result;
      // console.log(tableData);
    });

    return {
      currentPage1: ref(1),
      currentPage2: ref(5),
      currentPage3: ref(5),
      currentPage4: ref(4),
      handleSizeChange,
      handleCurrentChange,
      tableData,
      input: ref(""),
      onClick,
    };
  },
  // components: {
  //   Star,
  // },
});
</script>

<style lang="less" scoped>
.alist {
  margin: 15px 20px 15px 18px;
}
.nav {
  display: flex;
}
.sousuo {
  width: 212px;
  height: 40px;
  background: #ffffff;
  border: 1px solid #e9ecf7;
  border-radius: 4px;
  margin: 10px 13px 0px 10px;
}
.search {
  width: 90px;
  height: 37px;
  background: #ecf5ff;
  border: 1px solid #409eff;
  border-radius: 4px;
  margin: 11px 23px 0px 0px;
}
.reset {
  width: 90px;
  height: 37px;
  background: #f0f9eb;
  border: 1px solid #94cd79;
  border-radius: 4px;
  margin-top: 11px;
}
.icon-sousuo {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  margin: 11px 6px 12px 21px;
}
.icon-zhongzhi {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  margin: 12px 9px 12px 15px;
}
.table {
  margin-left: 10px;
  margin-top: 15px;
}
/deep/.has-gutter {
  font-size: 20px;
  text-align: center;
  color: black;
}
</style>
